/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author quanghv
 */
public class GetCnn {

    static Connection cnn = null;

    public static Connection getCnn() {
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            String url = "jdbc:sqlserver://localhost:1433;databaseName=bigdeal";
            try {
                cnn = DriverManager.getConnection(url, "sa", "12345");
            } catch (SQLException ex) {
                Logger.getLogger(GetCnn.class.getName()).log(Level.SEVERE, null, ex);
            }

            if (cnn != null) {
                return cnn;
            }
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(GetCnn.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }
}
